import request from '@/config/axios'

export interface AgentVO {
  id: number
  name: string
  refAgentAdmin: string
}

// 查询代理商分页
export const getAgentPage = async (params) => {
  return await request.get({ url: `/meijia/agent/page`, params })
}

// 查询代理商详情
export const getAgent = async (id: number) => {
  return await request.get({ url: `/meijia/agent/get?id=` + id })
}

// 新增代理商
export const createAgent = async (data: AgentVO) => {
  return await request.post({ url: `/meijia/agent/create`, data })
}

// 修改代理商
export const updateAgent = async (data: AgentVO) => {
  return await request.put({ url: `/meijia/agent/update`, data })
}

// 删除代理商
export const deleteAgent = async (id: number) => {
  return await request.delete({ url: `/meijia/agent/delete?id=` + id })
}

// 导出代理商 Excel
export const exportAgent = async (params) => {
  return await request.download({ url: `/meijia/agent/export-excel`, params })
}
// 代理商列表
export const getByAgentCode = async (params) => {
  return await request.get({ url: `/meijia/agent/get-by-agent`, params })
}
